package com.kd.service.token;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kd.dao.CustomerMapper;
import com.kd.entity.Customer;
import org.springframework.stereotype.Service;

@Service
public class CustomerTokenServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerTokenService {

    @Override
    public String getToken(Customer user) {
        String token="";
        token= JWT.create().withAudience(String.valueOf(user.getCid()))
                .sign(Algorithm.HMAC256(user.getPassword()));

        return token;
    }



}
